package test.com;

import javax.sound.sampled.*;

public class ListSupportedFormats {
    public static void main(String[] args) {
        Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
        for (Mixer.Info mixerInfo : mixerInfos) {
            Mixer mixer = AudioSystem.getMixer(mixerInfo);
            Line.Info[] lineInfos = mixer.getSourceLineInfo();
            for (Line.Info lineInfo : lineInfos) {
                System.out.println("Mixer: " + mixerInfo.getName());
                System.out.println("Line: " + lineInfo);
                if (lineInfo instanceof DataLine.Info) {
                    DataLine.Info dataLineInfo = (DataLine.Info) lineInfo;
                    AudioFormat[] formats = dataLineInfo.getFormats();
                    for (AudioFormat format : formats) {
                        System.out.println("Supported format: " + format);
                    }
                }
            }
        }
    }
}